﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using thousandclear.Data;

namespace thousandClear.Areas.Shop.Controllers
{
    public class TestController : BaseController
    {
        // GET: Shop/Test
        public ActionResult Index()
        {
            string openid = "ohm5Hv_CnJzs-G2I6sfPmBBOMoA0";
            using (var db = new qianjingEntities())
            {
                //var logid = "";
                var customer = db.O_Customer.Where(a => a.ocOpenid == openid).FirstOrDefault();
                var order = db.T_Order.Where(a => a.toOCID ==customer.OCID).FirstOrDefault();
                var good = db.O_Goods.Where(a => a.OGSID == order.toOGID).FirstOrDefault();
                //推送模板消息_karl_20160726
                string _openid = openid;
                string _token = UtilNS.Util.GetAccessTokenOpen();
                string _serviceContent = good.ogsDesc + "，每月" + good.ogsTimeMonth + "次";
                int _daily = good.ogsTime;
                int _spec = (int)good.ogsSignTime;
                string _server = getAuntInfo(order.toOATID);
                string url = "https://open.weixin.qq.com/connect/oauth2/authorize?appid=wx719afdb0aa0ebec4&redirect_uri=http%3a%2f%2fwww.qianjing-china.com%2ftest%2fshop%2fMessage%2findex2%3f&response_type=code&scope=snsapi_userinfo&state=STATE#wechat_redirect ";
                SendMessage_Comment(_openid, _token, _serviceContent, _daily, _spec, _server, url);
                return View();
            }

        }
    }
}